import yaml
import os

from common import dir_config as dirconfig
import jsonpath
class Data:
    def __init__(self,key=None,filename='Test_data.yml'):
        filepath=os.path.join(dirconfig.testcase_url,filename)
        with open(filepath,encoding='utf-8') as file:
            self.datas=yaml.load(stream=file,Loader=yaml.FullLoader)
            if key != None:
                 self.data=jsonpath.jsonpath(self.datas,f'$..{key}')

if __name__ == '__main__':
    data1 =Data().datas
    print(data1)



